﻿/// <reference path="../jquery.min.js" />
/// <reference path="../module/rssapi.v2.js" />

$("#articleitempage").load(function () {
    RssApi.Table.List("article").setLoading().getJson(function (json) {
        console.info(json,'json');
        $(".needList-list").maplist(json, {
            "shijian": function (val) {
                return new Date(val * 1000).toString("yyyy-MM-dd HH:mm:ss");
            }
        })
    });
});

$("#articledetailpage").load(function () {
    var t = $(this);
    t.find("[rsstitle],[matter]").empty();

    RssApi.Table.Detail("article").condition(new RssDict(t.data("mapquery")).getDict()).getJson(function (json) {
        t.mapjson(json, {
            "title": function (val) {
                return val.length > 20 ? val.substring(0, 20) : val;
            }
        });

        t.find("[ry-collect]").attr("relationid", json["id"]);
        t.find("[ry-praise]").attr("relationid", json["id"]);
        t.find("[ry-attention]").attr("relationid", json["id"]);
        t.find("[ry-pay]").attr("relationid", json["id"]).attr("unitprice", json["price"]);
    });
});
